from building import *

cwd = GetCurrentDir()
CPPPATH = [cwd]
src = []

if GetDepend('SUPPORT_SPI_LPC_ARM'):
    src += Glob('SpiDev_Lpc_Arm.c') 
    if GetDepend('SUPPORT_SPI_INSTANCE1'):
        src += Glob('Spi_Lpc_Arm.c') 
elif GetDepend('SUPPORT_SPI_AVR'):
    src += Glob('SpiDev_Avr.c') 
    if GetDepend('SUPPORT_SPI_INSTANCE1'):
        CPPPATH.append(cwd + "/Spi_Cs1")
        src += Glob('Spi_Cs1/Spi_Cs1_Avr.c')    
elif GetDepend('SUPPORT_SPI_PIC'):
    src += Glob('SpiDev_Pic.c') 
    if GetDepend('SUPPORT_SPI_INSTANCE1'):
        CPPPATH.append(cwd + "/Spi_Cs1")
        src += Glob('Spi_Cs1/Spi_Cs1_Pic.c') 
elif GetDepend('SUPPORT_SPI_SOFT2'):
    src += Glob('SpiDev_Soft.c') 
    if GetDepend('SUPPORT_SPI_INSTANCE1'):
        CPPPATH.append(cwd + "/Spi_Cs1")
        src += Glob('Spi_Cs1/Spi_Cs1_Soft.c')  

#增加SUPPORT_EX_PREINCLUDE定义以预包含Preinclude.h
predefine = ['SUPPORT_EX_PREINCLUDE']
group = DefineGroup('spi', src, depend = [''], CPPPATH=CPPPATH, CPPDEFINES = predefine)
Return('group')
